<style>

  #memberMain .tapList .tableClassA tbody tr {
    height: 32px;
    line-height: 32px;
  }

  #memberMain .tapList .tableClassA tbody tr td {
    padding: 0;
  }
</style>
<div id="memberMain" class="success">
  <div class="title"><h4>收件方式</h4></div>
  <div class="tipsTop">一个账号最多添加5个收件方式</div>
  <div class="height18"></div>
  <form autocomplete="off" id="recharge-form">
    <ul class="formUl" id="userBank">
      <li class="">
        <label class="inputName">联系人</label>
        <input class="inputText cardName" name="username" id="raName" type="text"
               style="color: rgb(0, 0, 0);">
      </li>
      <li class="">
        <label class="inputName">联系电话</label>
        <input class="inputText cardName" name="linkcall" id="raPhone" type="text"
               style="color: rgb(0, 0, 0);">
      </li>
      <li class="">
        <label class="inputName">收件地址</label>
        <input class="inputText cardName" name="address" id="raAddr" type="text"
               style="color: rgb(0, 0, 0);">
      </li>
    </ul>
    <ul class="formUl">
      <li class="">
        <input class="inputBut showL inputBtnBig" type="button" value="确认" id="jax">
      </li>
    </ul>
  </form>
  <div class="height18"></div>
  <div class="tapList borderGray clearfix">
    <div class="tapTile">
      <h3 class="curr"><a href="javascript:void(0);">收件方式</a></h3>
    </div>
    <div class="height5"></div>
    <div class="tableClassA clearfix">
      <table cellpadding="0" cellspacing="0">
        <thead>
        <tr>
          <th>联系人</th>
          <th>联系电话</th>
          <th>收件地址</th>
          <th>操作</th>
        </tr>
        </thead>
        <tbody>
        <tr class="noList showCss" ng-repeat="item in contents" data-tid="{{item.tid}}">
          <td>
            {{item.raName}}
          </td>
          <td>
            {{item.raPhone}}
          </td>
          <td>
            {{item.raAddr}}
          </td>
          <td>
            <a href="javascript:void(0)" class="del" onclick="del_addr(this)">
              删除
            </a>
          </td>
        </tr>
        </tbody>
      </table>
    </div>
    <div style="margin-left: 20px;">
      <div paging
           ul-class="pagination"
           page="currentPage"
           page-size="pageSize"
           total="total"
           show-prev-next="true"
           show-first-last="true"
           text-first="&laquo;"
           text-last="&raquo;"
           text-next="&rsaquo;"
           text-prev="&lsaquo;"
           text-title-page="第{page}页"
           text-title-first="首页"
           text-title-last="尾页"
           text-title-next="下一页"
           text-title-prev="上一页"
           paging-action="pageAction('Action', page,pageSize,total)">
      </div>
    </div>
  </div>
</div>
<script type="text/javascript">

  function del_addr(e) {
    $('body').mLoading('show');
    $.ajax({
      url: '/addr/del',
      data: {
        tid: $(e).parent().parent().attr('data-tid')
      },
      type: 'post',
      success: function (json) {
        $('body').mLoading('hide');

        if (json.retCode == 1) {
          $(e).parent().parent().remove();
        } else {
          alert('操作失败');
        }
      }
    });
  }

  $(function () {

    $('#jax').bind('click', add);

    function add() {
      $('body').mLoading('show');
      $.post('/addr/add', {
        raName: $('#raName').val(),
        raPhone: $('#raPhone').val(),
        raAddr: $('#raAddr').val()
      }, function (data) {

        if (data.retCode == 1) {
          $('body').mLoading('hide');
          success(data.retMsg, function () {
            location.reload();
          })
        } else {
          $('body').mLoading('hide');
          error(data.retMsg, function () {

          })
        }
      })
    }
  })

  function dell(mid) {
    $('body').mLoading('show');
    $.post('/transaction/mailpost-del', {id: mid}, function (data) {
      if (data.code == 1) {
        $('body').mLoading('hide');
        success(data.msg, function () {
          location.href = "";
        })
      } else {
        $('body').mLoading('hide');
        error(data.msg, function () {

        })
      }
    })
  }
</script>
